<%@page import="javax.servlet.http.*"%>

<HTML>
	<HEAD>
		<TITLE>Multimedia Database: Complicated Queries</TITLE>
	</HEAD>
	
	<BODY>
		<H1>Multimedia Database: Complicated Queries</H1>
		
		<!-- uses query string to determine chosen search category -->
		<%String qs = request.getQueryString();%>
		
		<!-- if query string is null (i.e. not specified), lets the user choose the query -->
		<%if (qs == null) {%>
			<h3>Select a query and you will be asked for the appropriate input.</h3><BR>
		
			Click <a HREF="http://localhost:8080/mmdb_complicated.jsp?1">here</a> to find the names of all actors that have acted in at least x Movies, y TV shows, and z Radio shows.
			<BR><BR>
			Click <a HREF="http://localhost:8080/mmdb_complicated.jsp?2">here</a> to find all actors over the age of a and not alive who have acted, directed, written, and produced some form of media.
			<BR><BR>
			Click <a HREF="http://localhost:8080/mmdb_complicated.jsp?3">here</a> to find the names of all directors with at least n award-winning films. 
			<BR><BR>
			Click <a HREF="http://localhost:8080/mmdb_complicated.jsp?4">here</a> to find the names of all writers whose films have grossed over d dollars for a particular company c.
			<BR><BR>
			Click <a HREF="http://localhost:8080/mmdb_result.jsp?c5">here</a> to find the parent company with the most subsidiary companies.
			
		<!-- each of the following "else if" statements handles the various search categories and displays the appropriate search fields, -->
		<!-- again using the query string to tell the results page which category it will be dealing with -->
		<%}
		else if (qs.equals("1")) {%>
			<H2>Query: Find the names of all actors that have acted in at least x Movies, y TV shows, and z Radio shows.</H2>
			<H3>
				Enter the following information to complete the query.
			</H3>
			
			<FORM NAME="q1" ACTION="mmdb_result.jsp?c1" METHOD="POST">
				Minimum number of movies: <INPUT TYPE="TEXT" SIZE=50 NAME="minMovies"> <BR><BR>
				Minimum number of TV shows: <INPUT TYPE="TEXT" SIZE=50 NAME="minTV"> <BR><BR>
				Minimum number of Radio shows: <INPUT TYPE="TEXT" SIZE=50 NAME="minRadio"> <BR><BR>
				<INPUT TYPE="SUBMIT" value="Submit">
			</FORM>
		<%}
		else if (qs.equals("2")) {%>
			<H2>Query: Find all actors over the age of a and not alive who have acted, directed, written, and produced some form of media.</H2>
			<H3>
				Enter the following information to complete the query.
			</H3>
			
			<FORM NAME="q2" ACTION="mmdb_result.jsp?c2" METHOD="POST">
				Enter the age that the actors must be older than: <INPUT TYPE="TEXT" SIZE=50 NAME="age"> <BR><BR>
				<INPUT TYPE="SUBMIT" value="Submit">
			</FORM>
		<%}
		else if (qs.equals("3")) {%>
			<H2>Query: Find the names of all directors with at least n award-winning films. </H2>
			<H3>
				Enter the following information to complete the query.
			</H3>
			
			<FORM NAME="q3" ACTION="mmdb_result.jsp?c3" METHOD="POST">
				Minimum number of award-winning films: <INPUT TYPE="TEXT" SIZE=50 NAME="minNoAwards"> <BR><BR>
				<INPUT TYPE="SUBMIT" value="Submit">
			</FORM>	
		<%}
		else if (qs.equals("4")) {%>
			<H2>Query: Find the names of all writers whose films have grossed over d dollars for a particular company c.</H2>
			<H3>
				Enter the following information to complete the query.
			</H3>
			
			<FORM NAME="q4" ACTION="mmdb_result.jsp?c4" METHOD="POST">
				Enter the number of dollars the film must have earned more than: <INPUT TYPE="TEXT" SIZE=50 NAME="dollars"> <BR><BR>
				Enter the company that has financed the films: <INPUT TYPE="TEXT" SIZE=50 NAME="company"> <BR><BR>
				<INPUT TYPE="SUBMIT" value="Submit">
			</FORM>		
		<%}%>
		
		<BR><BR>
		
		<!-- links to navigate the site -->
		<table border="3"><tr>
		
		<%if (qs != null) {%>
			<td><a href="http://localhost:8080/mmdb_complicated.jsp">Select a new complicated query</a></td>
		<%}%>
		
		<td><a href="http://localhost:8080/mmdb_home.jsp">Return to simple search</a></td>
		<td><a href="http://localhost:8080/mmdb_option.jsp">Start a new refined search</a></td>
		</tr></table>
	</BODY>
</HTML>